﻿<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
	<meta http-equiv="content-type" content="text/html;charset=utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>MinuteClinic-一分钟网上诊所管理系统</title>
	<!-- Fav  Icon Link -->
	<link rel="shortcut icon" type="image/png" th:href="@{../images/fav.png}">
	<!-- Bootstrap core CSS -->
	<link rel="stylesheet" th:href="@{../css/bootstrap.min.css}">
	<!-- themify icons CSS -->
	<link rel="stylesheet" th:href="@{../css/themify-icons.css}">
	<!-- Animations CSS -->
	<link rel="stylesheet" th:href="@{../css/animate.css}">
	<!-- Main CSS -->
	<link rel="stylesheet" th:href="@{../css/styles.css}">
	<link rel="stylesheet" th:href="@{../css/green.css}" id="style_theme">
	<link rel="stylesheet" th:href="@{../css/responsive.css}">
	<!-- morris charts -->
	<link rel="stylesheet" th:href="@{../charts/css/morris.css}">
	<!-- jvectormap -->
	<link rel="stylesheet" th:href="@{../css/jquery-jvectormap.css}">
	<link rel="stylesheet" th:href="@{../datatable/dataTables.bootstrap4.min.css}">

	<script th:src="@{../js/modernizr.min.js}"></script>
</head>

<body>
	<!-- Pre Loader -->
	<div class="loading">
		<div class="spinner">
			<div class="double-bounce1"></div>
			<div class="double-bounce2"></div>
		</div>
	</div>
	<!--/Pre Loader -->
	<!-- Color Changer -->
	<div class="theme-settings" id="switcher">
		<span class="theme-click">
			<span class="ti-settings"></span>
		</span>
		<span class="theme-color theme-default theme-active" data-color="green"></span>
		<span class="theme-color theme-blue" data-color="blue"></span>
		<span class="theme-color theme-red" data-color="red"></span>
		<span class="theme-color theme-violet" data-color="violet"></span>
		<span class="theme-color theme-yellow" data-color="yellow"></span>
	</div>
	<!-- /Color Changer -->
	<div class="wrapper">
		<!-- Page Content -->
		<div id="content">
				<!-- Top Navigation -->
				<div class="container top-brand">
					<nav class="navbar navbar-default">			
						<div class="navbar-header">
							<div class="sidebar-header"> <a href="index.html"><img th:src="@{../images/logo-dark.png}" class="logo" alt="logo"></a>
							</div>
						</div>
						<ul class="nav justify-content-end">
							<li class="nav-item">
								<a class="nav-link">
									<span title="Fullscreen" class="ti-fullscreen fullscreen"></span>
								</a>							
							</li>
							<li class="nav-item">
								<a class="nav-link dropdown-toggle" id="userinfo" data-toggle="dropdown" href="#" role="button" aria-haspopup="true"
								 aria-expanded="false">
									<span class="ti-announcement"></span>
								</a>
								<div class="dropdown-menu lochana-box-shadow2 notifications animated flipInY">
								<h5>Notifications</h5>
								<a class="dropdown-item" href="#">
									<span class="ti-wheelchair"></span> 新增[[*{totals}]]位病人</a>
							</div>
							</li>
							<li class="nav-item">
								<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true"
								 aria-expanded="false">
									<span class="ti-user"></span>
								</a>
								<div class="dropdown-menu lochana-box-shadow2 profile animated flipInY">
									<h5><span id="username">[[${session.sessionValue}]]</span></h5>
									<a class="dropdown-item" href="/logout">
										<span class="ti-power-off"></span> Logout</a>

								</div>
							</li>
						</ul>
				
					</nav>
				</div>
				<!-- /Top Navigation -->
				<!-- Menu -->
				<div class="container menu-nav">
					<nav class="navbar navbar-expand-lg lochana-bg text-white">
						<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
						 aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
							<span class="ti-menu text-white"></span>
						</button>
				
						<div class="collapse navbar-collapse" id="navbarSupportedContent">
							<ul class="navbar-nav mr-auto">
								<li class="nav-item dropdown">
									<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true"
									   aria-expanded="false"><span class="ti-home"></span> 个人面板</a>
									<div class="dropdown-menu">
										<a class="dropdown-item" href="/doctor/doctorUser">医生</a>
									</div>
								</li>
								<li class="nav-item dropdown">
									<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true"
									   aria-expanded="false"><span class="ti-wheelchair"></span> 病人信息</a>
									<div class="dropdown-menu">
										<a class="dropdown-item" href="/doctor/patients">病人信息</a>
									</div>
								</li>
								<li class="nav-item dropdown">
									<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true"
									 aria-expanded="false"><span class="ti-file"></span> 其它页面</a>
									<div class="dropdown-menu">
										<a class="dropdown-item" href="/index">主页</a>
										<a class="dropdown-item" href="/login">登录</a>
										<a class="dropdown-item" href="/view/modifyPwd">忘记密码</a>
									</div>
								</li>
							</ul>
						</div>
					</nav>
				</div>
				<!-- /Menu -->
				<!-- Breadcrumb -->
				<!-- Page Title -->
				<div class="container mt-0">
					<div class="row breadcrumb-bar">
						<div class="col-md-6">
							<h3 class="block-title">病人信息</h3>
						</div>
						<div class="col-md-6">
							<ol class="breadcrumb">
								<li class="breadcrumb-item">
									<a href="index.html">
										<span class="ti-home"></span>
									</a>
								</li>
								<li class="breadcrumb-item">病人信息</li>
								<li class="breadcrumb-item active">All 病人信息</li>
							</ol>
						</div>
					</div>
				</div>
			<!-- /Page Title -->

			<!-- /Breadcrumb -->
			<!-- Main Content -->
			<div class="container">

				<div class="row">
					<!-- Widget Item -->
					<div class="col-md-12">
						<div class="widget-area-2 lochana-box-shadow">
							<h3 class="widget-title">病人信息 List</h3>
							<div class="table-responsive mb-3">
								<table id="tableId" class="table table-bordered table-striped">
									<thead>
										<tr>
											<th class="no-sort">
													<input type="checkbox" id="allId" value="0">
											</th>
											<th>Patient ID</th>
											<th>姓名</th>
											<th>Age</th>
											<th>地址</th>
											<th>状态</th>
											<th>回复</th>
										</tr>
									</thead>
									<tbody>
									<tr th:each="user : ${list}" th:object="${user}">
											<td>
												<input  type="checkbox" id="userid" name="userid" th:value="*{userid}">
											</td>
											<td>[[*{id}]]</td>
											<td>[[*{name}]]</td>
											<td>[[*{age}]]</td>
											<td>[[*{address}]]</td>
											<td>[[*{consultation.content}]]</td>
											<td>[[*{consultation.reply}]]</td>
										</tr>
									</tbody>
								</table>
								<!--Export links-->
								<nav aria-label="Page navigation example">
									<ul class="pagination justify-content-center export-pagination">
										<li class="page-item">
											<button class="page-link" onclick="OutputExce()"><span class="ti-align-justify"></span> Excel</button>
										</li>
									</ul>
								</nav>
								<!-- /Export links-->
								<button type="button" class="btn btn-primary mt-3 mb-0" id="file" name="file"><span class="ti-pencil-alt"></span> 编辑</button>
							</div>
						</div>
					</div>
					<!-- /Widget Item -->
				</div>
			</div>
			<!-- /Main Content -->
			<!--Copy Rights-->
            <div class="container">
                <div class="d-sm-flex justify-content-center">
                    <span class="text-muted text-center d-block d-sm-inline-block">天码行空 © 2020 </span>
                </div>
            </div>
			<!-- /Copy Rights-->
		</div>
		<!-- /Page Content -->
	</div>
	<!-- Back to Top -->
	<a id="back-to-top" href="#" class="back-to-top">
		<span class="ti-angle-up"></span>
	</a>

	<!-- 编辑员工模态窗口 -->
	<div id="editEmpModal" class="modal fade" tabindex="-1" role="dialog"
		 aria-labelledby="gridSystemModalLabel">

		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
							aria-label="Close">
						<span aria-hidden="true">&times;</span>
					</button>
					<h4 class="modal-title" id="reply">询诊回复</h4>
				</div>
				<input type="hidden" id="updateid" name="updateid" value="" />
				<div class="modal-body">
					<form class="form-horizontal"  id="patientForm">
						<div class="form-group">
							<label class="col-sm-2 control-label">姓名:</label>
							<input type="text" id="name"disabled name="name" placeholder="姓名" value="">
						</div>
							<div class="form-group">
								<label  class="col-sm-2 control-label">性别:</label>
								<input type="text" id="sex" disabled  name="sex" placeholder="性别" value="">
							</label>
							</div>
						<div class="form-group">
								<label class="col-sm-2 control-label" >age:</label>
								<input type="text" id="age"disabled name="age" placeholder="年龄" value="">
							</div>
						<div class="form-group">
							<label class="col-sm-2 control-label" >询诊:</label>
							<input type="text" id="consul" disabled name="conclu" placeholder="询诊内容" value="">
						</div>
						<div class="form-group">
								<label class="col-sm-2 control-label">回复:</label>
							<textarea name="replyContent" id="replyContent" rows="10" cols="50"  title="询诊的内容，每条不能超过800字。"
									  onMouseOver="this.style.backgroundColor = '#E5F0FF'"
									  onMouseOut="this.style.backgroundColor = ''" placeholder="请输入内容"></textarea>
							</div>
				</form>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
					<button type="button" class="btn btn-primary" id="addBtn">回复</button>
				</div>

			</div>
		</div>
	</div>
	<!-- /Back to Top -->
	<!-- Jquery Library-->
	<script src="../js/jquery-3.2.1.min.js">

	</script>
	<!-- Popper Library-->
	<script src="../js/popper.min.js"></script>
	<!-- Bootstrap Library-->
    <script src="../js/bootstrap.min.js">

	</script>
    
    <!-- Datatable  -->
	<script src="../datatable/jquery.dataTables.min.js"></script>
	<script src="../datatable/dataTables.bootstrap4.min.js"></script>
    
	<!-- Custom Script-->
	<script src="../js/custom.js"></script>
	<script src="../js/custom-datatables.js"></script>
	<script type="text/javascript">
		$(function() {
			$("#file").click(function() {
				var id = $("input[name='userid']:checked").val();
				//alert(id);
				if($("input[type='checkbox']").is(':checked')==false){
					alert("请选泽");
				}else{
					//弹出模态窗口
					$.ajax({
						url: "/findById",
						type: "POST",
						data: {"userid":id},
						success: function (result) {
							//清空表单
							document.getElementById("patientForm").reset();
							var user=result.data.list;
							$("#updateid").attr("value", user[0].userid);
							$("#name").attr("value", user[0].patient.name);
							$("#sex").attr("value", user[0].patient.sex);
							$("#age").attr("value", user[0].patient.age);
							$("#consul").attr("value",user[0].consultation.content);
						}

					})

					$('#editEmpModal').modal({
						backdrop : "static"
					});
				}

			});
		});
		$(function () {
			$('#userinfo').click();
		});
	</script>
	<script language="JavaScript" type="text/JavaScript">

	</script>
	<script type="text/javascript">
		$("#addBtn").click(function(){
			$.ajax({
				url:"/doctor/reply",
				type: "POST",
				dataType: 'json',
				data:{
					"userid":$("input[name='updateid']").val(),
					"reply":$("textarea[name='replyContent']").val()
				},
				success: function (result) {
					console.log(result);
					if (result.code == 200) {
						alert("更新成功");
						window.location.href = "/doctor/patients";
					} else {
						alert(result.data.errors);
					}

				}

			});
		});
	</script>
	<script type="text/javascript">
		function OutputExce() {
			if (confirm('是否导出成Excel')) {
				window.location.href = "/excel/OutputExcel";
			}
		}
	</script>
</body>

</html>